Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log errno names instead of values #49

Closed
wants to merge 5 commits into from

Conversation

udit043
Copy link
Contributor

@udit043 udit043 commented Jun 23, 2016

Please visit https://github.com/udit043/resiprocate/tree/patch-6.
I have created new branch for this task. After discussion with mentor will close and create new pull request.

@@ -677,14 +678,14 @@ const char * inet_ntop6(const u_char *src, char *dst, size_t size);
//adapted from freebsd inet_ntop.c(1.12) and inet_pton.c(1.5) for windows(non-compliant snprinf workaround)
/* const char *
* inet_ntop4(src, dst, size)
* format an IPv4 address, more or less like inet_ntoa()
* format an IPv4 address, more or less like inet_ntoa()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please don't include these formatting changes

@dpocock
Copy link
Member

dpocock commented Jul 19, 2016

I've had a closer look at this

On Windows, the error names and numbers are different:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms740668%28v=vs.85%29.aspx

What I'd like to see in Errdes.hxx:

  • some classes:
    • a base class called AbstractError
    • a subclass of AbstractError called NumericError
    • three subclasses of NumericError called ErrnoError, OpenSSLError and X509Error
  • each class should override the << stream operator to return a string for use in log messages
  • each class should provide a static factory method for getting an instance, e.g.
    const ErrnoError& ErrnoError::getErrorInstance(const int errorCode);
  • instances should be cached, the getErrorInstance method should always return the same instance for a given error code
  • make sure you don't assume the numeric values that the names correspond to, you must make sure you use each macro somewhere. E.g. if you were putting them in a hash map at initialization time, you might do:
    my_map[ENOENT] = ErrnoError(ENOENT, "ENOENT", "No such file or directory");
  • use the relevant object in the code, e.g. wherever there is a call to getErrno() or strerror(), use an instance of ErrnoError instead.

@udit043
Copy link
Contributor Author

udit043 commented Jul 19, 2016

Ok, working on it.

@dpocock
Copy link
Member

dpocock commented Jul 19, 2016

for now, just create the classes, don't worry about changing all the other code to use them yet. Let me look at the classes you create and we'll refine them before you change all the other code.

@udit043
Copy link
Contributor Author

udit043 commented Aug 17, 2016

Please visit https://github.com/udit043/resiprocate/tree/patch-6
I have created new branch and implement class and mapping for this task. After discussion with mentor will close and create new pull request.

@dpocock
Copy link
Member

dpocock commented Aug 23, 2016

Udit, can you please create a new pull request for me to comment on?

@udit043 udit043 closed this Aug 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants